from django.core.mail import send_mail

from celery_tasks.main import app


@app.task(name="send_verify_mail")
def send_verify_mail(subject, html_message, recipient_list):
    subject = subject  # 标题
    message = ""  # 内容
    html_message = html_message
    from_email = "chenchenya2021@126.com"  # 发送方地址
    recipient_list = recipient_list
    try:
        send_mail(subject, message, from_email, recipient_list, html_message=html_message)
    except Exception as e:
        print("发送邮件失败")
